<?php
include_once "../modele/Pizza.php";
include_once "../vue/js/ajouterItemScript.php";

$pizzas = Pizza::dbGetPizzas("");

echo '<div id="thePizzas">
	<ul class="thumbnails">';
foreach($pizzas as $pizza){
	$name = $pizza->getName();
	$image = $pizza->getImg();
	$sPrice = $pizza->getSmallPrice(false);
	$lPrice = $pizza->getLargePrice(false);
	$mPrice = $pizza->getMediumPrice(false);
	$sScore = $pizza->getSmallPrice(true);
	$lScore = $pizza->getLargePrice(true);
	$mScore = $pizza->getMediumPrice(true);
	setlocale(LC_MONETARY, 'can_US');
	echo '<li class="span3">
			<div class="thumbnail" data-toggle="modal" data-target="#modal'.$name.'">
				<img style="height:140px;" src="../vue/img/'.$image.'" alt="'.$name.'">
				<h4>'.$name.'</h4>
				<div style="height:60px">'.$pizza->getDescShort().'</div>
			</div>
				<!-- Pop-up -->
				<div id="modal'.$name.'" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				  <div class="modal-header">
				    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				    <h3 id="myModalLabel">'.$name.'</h3>
				  </div>
				  <div class="modal-body">
				    <div class="left">
						<img class="selected" src="../vue/img/'.$image.'">
							<table class="selected">
								<tr>
									<td style="width:250px" id="petit">
										Petit: 
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium cash" value="'.number_format($sPrice, 2, ',', ' ').'$" onclick=\'ajouter("'.$name.'","'.$sPrice.'","P", "Cash", "P")\'></input>
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium cash" value="'.$sScore.' Points" onclick=\'ajouter("'.$name.'","'.$sScore.'","P", "Score", "P")\'></input>
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium mod" value="Mod" onClick=\'mod()\');></button>
									</td>
								</tr>
								<tr>
									<td style="width:250px" id="petit">
										Moyen: 
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium cash" value="'.number_format($mPrice, 2, ',', ' ').'$" onclick=\'ajouter("'.$name.'","'.$mPrice.'","M", "Cash", "P")\'></input>
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium cash" value="'.$mScore.' Points" onclick=\'ajouter("'.$name.'","'.$mScore.'","M", "Score", "P")\'></input>
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium mod" value="Mod" onClick=\'mod()\');></button>
									</td>
								</tr>
								<tr>
									<td style="width:250px" id="petit">
										Grand: 
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium cash" value="'.number_format($lPrice, 2, ',', ' ').'$" onclick=\'ajouter("'.$name.'","'.$lPrice.'","L", "Cash", "P")\'></input>
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium cash" value="'.$lScore.' Points" onclick=\'ajouter("'.$name.'","'.$lScore.'","L", "Score", "P")\'></input>
									</td>
									<td style="width:250px" id="petit">
										<input name="page" type="button" class="btn btn-medium mod" value="Mod" onClick=\'mod()\');></button>
									</td>
								</tr>
							</table>
							</div>
							<div class="right">
								<p class="selected">'.$pizza->getDescLong().'</p>
							</div>
				  </div>
				  <div class="modal-footer">
				    <button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
				  </div>
			</div>
		</li>';
}
echo 	"</ul>";
echo "</div>";

?>